package com.yixiu.study.juc.collection;

import java.util.Vector;

/**
 * @CalssName T05_Vector
 * @Description 有锁，线程安全
 * @Author yixiu
 * @Date 2021/6/28 11:28
 * @Verison 1.0
 **/
public class T05_Vector {

    static Vector<String> tickets = new Vector<>();

    static {
        for (int i = 0; i < 10000; i++) {
            tickets.add("票据号：" + i);
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                while (tickets.size() > 0){
                    System.out.println("销售了 -- " + tickets.remove(0));
                }
            }).start();
        }


    }

}
